﻿@model KL.Store.Web.Models.ProductsModel
@using KL.Store.Core
@{
    Layout = null;
}
<div class="col-xs-12">
    <table class="table table-bordered">
        <thead>
            <tr>
                <td style="vertical-align: middle; cursor:pointer;" onclick="DetailFilter(1, @(ViewBag.Order == 1 && ViewBag.Sort == 1 ? "2" : "1"));">Stok Adı
                    <i class="@(ViewBag.Order == 1 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 1 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(2, @(ViewBag.Order == 2 && ViewBag.Sort == 1 ? "2" : "1"));">Ücretsiz Kargo
                    <i class="@(ViewBag.Order == 2 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 2 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(3, @(ViewBag.Order == 3 && ViewBag.Sort == 1 ? "2" : "1"));">Hızlı Kargo
                    <i class="@(ViewBag.Order == 3 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 3 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(4, @(ViewBag.Order == 4 && ViewBag.Sort == 1 ? "2" : "1"));">Yeni Ürün
                    <i class="@(ViewBag.Order == 4 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 4 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(5, @(ViewBag.Order == 5 && ViewBag.Sort == 1 ? "2" : "1"));">Fırsat Ürünü
                    <i class="@(ViewBag.Order == 5 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 5 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(6, @(ViewBag.Order == 6 && ViewBag.Sort == 1 ? "2" : "1"));">Kampanyalı Ürün
                    <i class="@(ViewBag.Order == 6 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 6 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(7, @(ViewBag.Order == 7 && ViewBag.Sort == 1 ? "2" : "1"));">Kampanyalı Göster
                    <i class="@(ViewBag.Order == 7 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 7 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(8, @(ViewBag.Order == 8 && ViewBag.Sort == 1 ? "2" : "1"));">Stok Tut
                    <i class="@(ViewBag.Order == 8 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 8 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(9, @(ViewBag.Order == 9 && ViewBag.Sort == 1 ? "2" : "1"));">Hediye Metni
                    <i class="@(ViewBag.Order == 9 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 9 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 7%; vertical-align: middle; cursor:pointer;" onclick="DetailFilter(10, @(ViewBag.Order == 10 && ViewBag.Sort == 1 ? "2" : "1"));">Özel Metin
                    <i class="@(ViewBag.Order == 10 && ViewBag.Sort == 2 ? "glyphicon glyphicon-chevron-up" : (ViewBag.Order == 10 ? "glyphicon glyphicon-chevron-down" : ""))"></i></td>
                <td style="width: 4%; text-align: center; vertical-align: middle;">
                    <input type="checkbox" name="SelectAll" class="SelectAll" id="SelectAll" title="Tümünü Seç" /></td>
            </tr>
        </thead>
        <tbody>
            @foreach (var item in Model.RelatedProducts)
            {
                <tr id="Product@(item.ProductId)" data-id="@(item.ProductId)">
                    <td>@(item.ProductName) (@(item.ProductId))</td>
                    <td style="text-align: center;" class="FreeCargoField">@Html.Raw(item.FreeCargo ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="FastCargoField">@Html.Raw(item.FastCargo ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="NewProductField">@Html.Raw(item.NewProduct ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="OpportunityProductField">@Html.Raw(item.OpportunityProduct ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="CampaignProductField">@Html.Raw(item.CampaignProduct ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="ShowAsCampaignProductField">@Html.Raw(item.ShowAsCampaignProduct ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="CheckStockField">@Html.Raw(item.CheckStock ? "<b>Evet</b>" : "Hayır")</td>
                    <td style="text-align: center;" class="GiftStringField">@Html.Raw(!string.IsNullOrEmpty(item.GiftString) ? "<b>Dolu</b>" : "Boş")</td>
                    <td style="text-align: center;" class="SpecialTextField">@Html.Raw(!string.IsNullOrEmpty(item.SpecialText) ? "<b>Dolu</b>" : "Boş")</td>
                    <td style="text-align: center;">
                        <input type="checkbox" name="product[]" class="SelectedProduct" id="ProductSelect@(item.ProductId)" data-id="@(item.ProductId)" /></td>
                </tr>
            }
        </tbody>
    </table>
</div>
<div class="col-xs-12">
    <hr />
    <h4>Seçilenlere Uygula;</h4>
    <div class="row">
        <div class="form-group">
            <div class="col-xs-4 col-sm-3 col-md-2">
                <select name="UygulaIslemSec" id="UygulaIslemSec" class="form-control UygulaIslemSec" style="width: 100%;">
                    <option value="">Seçiniz</option>
                    <option value="UCRETSIZKARGO">Ücretsiz Kargo</option>
                    <option value="HIZLIKARGO">Hızlı Kargo</option>
                    <option value="YENIURUN">Yeni Ürün</option>
                    <option value="FIRSATURUN">Fırsat Ürünü</option>
                    <option value="KAMPANYALIURUN">Kampanyalı Ürün</option>
                    <option value="KAMPANYALIGOSTER">Kampanyalı Göster</option>
                    <option value="STOKTUT">Stok Tut</option>
                    <option value="GIFTSTRING">Hediye Metni</option>
                    <option value="OZELMETIN">Özel Metin</option>
                </select>
            </div>
            <div class="col-xs-4 col-sm-3 col-md-2 UygulaIslemTF">
                <select name="UygulaIslemTF" id="UygulaIslemTF" class="form-control" style="width: 100%;">
                    <option value="">Seçiniz</option>
                    <option value="1">Evet</option>
                    <option value="0">Hayır</option>
                </select>
            </div>
            <div class="col-xs-4 col-sm-3 col-md-2 UygulaIslemEH">
                <select name="UygulaIslemTF" id="UygulaIslemEH" class="form-control" style="width: 100%;">
                    <option value="">Seçiniz</option>
                    <option value="E">Evet</option>
                    <option value="H">Hayır</option>
                </select>
            </div>
            <div class="col-xs-4 col-sm-3 col-md-2 UygulaIslemText">
                <input name="UygulaIslemText" id="UygulaIslemText" class="form-control" style="width: 100%;" />
            </div>
            <div class="col-xs-4 col-sm-3 col-md-2 UygulaIslemPost">
                <button type="button" class="btn btn-primary" onclick="IslemUygula();" id="UygulaIslemPost" disabled="disabled">Uygula</button>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>
<input type="hidden" name="vSelectedCategory" value="@(ViewBag.SelectedCategory)" />
<input type="hidden" name="vFreeCargo" value="@(ViewBag.FreeCargo)" />
<input type="hidden" name="vFastCargo" value="@(ViewBag.FastCargo)" />
<input type="hidden" name="vNewProduct" value="@(ViewBag.NewProduct)" />
<input type="hidden" name="vOpportunityProduct" value="@(ViewBag.OpportunityProduct)" />
<input type="hidden" name="vCampaignProduct" value="@(ViewBag.CampaignProduct)" />
<input type="hidden" name="vShowAsCampaignProduct" value="@(ViewBag.ShowAsCampaignProduct)" />
<input type="hidden" name="vGiftString" value="@(ViewBag.GiftString)" />
<input type="hidden" name="vSpecialText" value="@(ViewBag.SpecialText)" />
<input type="hidden" name="vCheckStock" value="@(ViewBag.CheckStock)" />
<input type="hidden" name="vOrder" value="@(ViewBag.Order)" />
<input type="hidden" name="vSort" value="@(ViewBag.Sort)" />